package cn.knet.excel.imp.knetexceltool.controller;

import cn.knet.excel.imp.knetexceltool.service.BindCleanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@Slf4j
public class BindCleanController {

    @Resource
    private BindCleanService bindCleanService;

    /**
     * 仅仅用来清洗  网址bind  的垃圾数据
     *
     * @return
     */
    @RequestMapping(value = "/tools/bind/clean", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String cleanBind()  {

        try {
            bindCleanService.startCleanBind();
            return "{\"code\":\"200\",\"msg\":\"成功执行\"}";
        } catch (Exception e) {
            e.printStackTrace();
            return "{\"code\":\"500\",\"msg\":\"执行异常\"}";
        }
    }
}
